package group2.model;

public class CarItem {
    private Book book;
    //数量
    private int num;
    //小计
    private double subTotal;

    public CarItem() {
    }

    public CarItem(Book book, int num) {
        this.book = book;
        this.num = num;
    }

    public CarItem(Book book, int num, double subTotal) {
        this.book = book;
        this.num = num;
        this.subTotal = subTotal;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public double getSubTotal() {
        return this.num*this.book.getPrice();
    }

    public void setSubTotal(double subTotal) {
        this.subTotal = subTotal;
    }
}
